package com.nbjtjc.safe.api.edu;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.nbjtjc.safe.annotation.SysLog;
import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.model.edu.EduCertificateRetrain;
import com.nbjtjc.safe.service.edu.EduCertificateRetrainService;
@RestController
@CrossOrigin("*")
@RequestMapping("/eduCertRetrain")
public class EduCertificateRetrainController {
	@Autowired
	private EduCertificateRetrainService eduCertificateRetrainService;


	  @RequestMapping(value = "/addOrUpdate",method = {RequestMethod.POST})
	  @SysLog("添加或更新持证培训复训记录")
	    public Result add(@RequestBody EduCertificateRetrain eduCertificateRetrain){
	        Result result=new Result();
	        try {
	            result=eduCertificateRetrainService.add(eduCertificateRetrain);
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }

	  
	  @RequestMapping(value = "/delete",method = {RequestMethod.POST})
	  @SysLog("删除持证培训复训记录")
	    public Result delete(@RequestBody EduCertificateRetrain eduCertificateRetrain) {
	        Result result=new Result();
	        try {
	            result=eduCertificateRetrainService.delete(eduCertificateRetrain.getId());
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }

	  @RequestMapping(value = "/find", method = {RequestMethod.POST})
	  public Result find(@RequestBody EduCertificateRetrain eduCertificateRetrain) {
	        Result result = new Result();

	        try {
	            result = eduCertificateRetrainService.find(eduCertificateRetrain);
	        } catch (Exception e) {
	            e.printStackTrace();
	            result.setFalse(e.getMessage());
	        }
	        return result;
	    }
}
